package com.arethusa;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;

import simpleorm.core.SConnection;
import simpleorm.core.SPreparedStatement;
import simpleorm.core.SResultSet;
import simpleorm.core.SValidationException;

import com.Ostermiller.util.CSVParser;
import com.Ostermiller.util.LabeledCSVParser;
import com.arethusa.langebaandb.ProgrammaBean;
import com.arethusa.langebaandb.ProgrammanummersBean;
import com.arethusa.langebaandb.StartBean;
import com.arethusa.langebaandb.Vereniging;
import com.arethusa.langebaandb.VerenigingBean;

public class ImportOLOWIS extends JPanel {

	private static final long serialVersionUID = 1L;
	private JLabel jLabel = null;
	private JTextField startsBestandTextField = null;
	private JButton laadStartsButton = null;
	private JButton zoekStartsButton = null;
	private JLabel jLabel1 = null;
	private JTextField programmaBestandTextField = null;
	private JButton laadProgrammaButton = null;
	private JButton zoekProgrammaButton = null;
	private JLabel jLabel2 = null;
	private JTextField progtitelBestandTextField = null;
	private JButton laadProgtitelsButton = null;
	private JButton zoekProgtitelsButton = null;
	private JPanel importPanel = null;
	private JPanel jPanel = null;
	private String importPath = null;
	
	private class ImportFileFilter extends FileFilter {

		//Can be "starts", "programma", "prognrs", "ver", "cat", "lftb"
		
		public ImportFileFilter(String type) {
			super();
		}
		
		public boolean accept(File f) {
			if(f != null) {
			    if(f.isDirectory()) {
			    	return true;
			    }
			    String extension = getExtension(f);
			    if(extension != null && extension.equalsIgnoreCase("csv")) {
			    	return true;
			    };
			}
			return false;
		}

		public String getDescription() {
			return "OLOWIS files (*.csv)";
		}
		
	    /**
	     * Return the extension portion of the file's name .
	     *
	     * @see #getExtension
	     * @see FileFilter#accept
	     */
	    public String getExtension(File f) {
		if(f != null) {
		    String filename = f.getName();
		    int i = filename.lastIndexOf('.');
		    if(i>0 && i<filename.length()-1) {
			return filename.substring(i+1).toLowerCase();
		    };
		}
		return null;
	    }
	}
	/*
	 *  Zoek Inschrijvingsbestand
	 */
	private class ZoekStartsButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
		    JFileChooser chooser = new JFileChooser(importPath);
		    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
		    chooser.setSelectedFile(new File(getStartsBestandTextField().getText()));
		    chooser.addChoosableFileFilter(new ImportFileFilter("starts"));
		    int returnVal = chooser.showOpenDialog(getImportPanel());
		    if(returnVal == JFileChooser.APPROVE_OPTION) {
		    	File file = chooser.getSelectedFile();
		    	importPath = file.getParent();
		    	getStartsBestandTextField().setText(file.getPath());
		    }
		}
		
	}

	/*
	 *  Importeren Inschrijvingsbestand
	 */
	private class LaadStartsButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			String dnr;
			String ver;
			String ckl;
			int ans = JOptionPane.showConfirmDialog(null,
					"Is programma.csv en progtitles.csv al geladen?.",
					"Laden", JOptionPane.YES_NO_CANCEL_OPTION);
			if( ans == JOptionPane.YES_OPTION ){
				//Open LabeledCVSParser
				Integer nrOfStarts = new Integer(0);
				boolean hasBegun = SConnection.getConnection().hasBegun();
				if( ! hasBegun ) { SConnection.begin(); }
				SConnection.rawUpdateDB("DELETE FROM start");
				SConnection.rawUpdateDB("ALTER TABLE start AUTO_INCREMENT = 1");
				SConnection.commit();
				try {
					LabeledCSVParser lcsvp = new LabeledCSVParser(new CSVParser(new FileInputStream(getStartsBestandTextField().getText())));
					lcsvp.changeDelimiter(';');
					while(lcsvp.getLine() != null) {
						StartBean strt = new StartBean();
						strt.setId(new Long(0));
						strt.setPrognr(new Integer(lcsvp.getValueByLabel("ProgNr")));
						strt.setSuffix(lcsvp.getValueByLabel("Suffix"));
						ckl = lcsvp.getValueByLabel("CapKleur");
						if( ckl.length()>25 ) ckl = ckl.substring(0, 25);
						strt.setCapkleur(ckl);
						String capnr=lcsvp.getValueByLabel("CapNr");
						if(capnr != null && capnr.length()>0 )strt.setCapnr(new Integer(capnr));
						strt.setVast(new Boolean((lcsvp.getValueByLabel("Vast")).equalsIgnoreCase("1")?true:false));
						ckl = lcsvp.getValueByLabel("StartNr");
						if( ckl.length() < 9 ) 
							ckl = "0000000".substring(0, 9-ckl.length()) + ckl;
						strt.setStartnr(ckl);
						strt.setNaam(lcsvp.getValueByLabel("Naam"));
						dnr = lcsvp.getValueByLabel("DepotNr");
						if( dnr.length() == 4 ) dnr = "0" + dnr;  
						strt.setDepotnr(dnr);
						ver = lcsvp.getValueByLabel("Vereniging");
						strt.setVereniging(ver);
						strt.setInschrijver(lcsvp.getValueByLabel("Inschrijver"));
						strt.setEindtijd(lcsvp.getValueByLabel("Eindtijd"));
						strt.setDis(lcsvp.getValueByLabel("Dis"));
						if(lcsvp.getValueByLabel("EindtijdInSec") != null)
							strt.setEindtijdinsec(new BigDecimal(lcsvp.getValueByLabel("EindtijdInSec")));
						strt.create();
						nrOfStarts = new Integer(nrOfStarts.intValue() + 1);
						// Check of vereniging al bestaat in Vereniging tabel.
						// Zo niet, voeg toe. Als naam anders is, wijzig naam.
						boolean hasBegun1 = SConnection.getConnection().hasBegun();
						if( ! hasBegun1 ) { SConnection.begin(); }
						SPreparedStatement stmt = Vereniging.meta.select(
								"DepotNr="+dnr, "DepotNr");
						SResultSet res = stmt.execute();
						/// loop through the results
						if (res.hasNext()) {	// bestaat al
							VerenigingBean v = new VerenigingBean(((Vereniging)res.getRecord()));
					    	SConnection.commit();
							if( ! v.getNaam().equalsIgnoreCase(ver) ) {
								//naam is anders, dus update naam
//								System.out.println("Vereniging "+v.getNaam()+"("+dnr+") heet nu "+ver);
								v.setNaam(ver);
								v.update();
							}
						} else {				// is nieuw
					    	SConnection.commit();
							VerenigingBean v = new VerenigingBean();
							v.setDepotnr(new Integer(dnr));
							v.setNaam(lcsvp.getValueByLabel("Vereniging"));
//							System.out.println("Vereniging "+v.getNaam()+"("+dnr+") is nieuw.");
							v.create();
						}
						
					}
					
					JOptionPane.showMessageDialog(null,
							nrOfStarts.toString()+" starts binnengehaald en opgeslagen.",
							"Import", JOptionPane.INFORMATION_MESSAGE);
					lcsvp.close();
				} catch (FileNotFoundException e) {
					JOptionPane.showMessageDialog(null,
							e.getMessage(),
							"Import", JOptionPane.ERROR_MESSAGE);
				} catch (IllegalStateException e) {
					JOptionPane.showMessageDialog(null,
							e.getMessage(),
							"Import", JOptionPane.ERROR_MESSAGE);
				} catch (IOException e) {
					JOptionPane.showMessageDialog(null,
							e.getMessage(),
							"Import", JOptionPane.ERROR_MESSAGE);
				} catch (SValidationException e) {
					JOptionPane.showMessageDialog(null,
							"Record "+nrOfStarts.toString()+e.getMessage(),
							"Import", JOptionPane.ERROR_MESSAGE);
				}
			}
		}
		
	}

	/*
	 *  Zoek Programma bestand
	 */
	private class ZoekProgrammaButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
		    JFileChooser chooser = new JFileChooser(importPath);
		    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
		    chooser.setSelectedFile(new File(getProgrammaBestandTextField().getText()));
		    chooser.addChoosableFileFilter(new ImportFileFilter("programma"));
		    int returnVal = chooser.showOpenDialog(getImportPanel());
		    if(returnVal == JFileChooser.APPROVE_OPTION) {
		    	File file = chooser.getSelectedFile();
		    	importPath = file.getParent();
		    	getProgrammaBestandTextField().setText(file.getPath());
		    }
		}
		
	}

	/*
	 *  Importeren Programma bestand
	 */
	private class LaadProgrammaButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			//Open LabeledCVSParser
			Integer nrOfStarts = new Integer(0);
			boolean hasBegun = SConnection.getConnection().hasBegun();
			if( ! hasBegun ) { SConnection.begin(); }
			SConnection.rawUpdateDB("DELETE FROM programma");
			SConnection.rawUpdateDB("DELETE FROM statistiekenperprogramma");
			SConnection.commit();
			try {
				String fnm = getProgrammaBestandTextField().getText();
				String f1 = fnm.substring(fnm.length()-17,fnm.length()-11);
				LabeledCSVParser lcsvp = new LabeledCSVParser(new CSVParser(new FileInputStream(fnm)));
				lcsvp.changeDelimiter(';');

				while(lcsvp.getLine() != null) {

					ProgrammaBean prg = new ProgrammaBean();
					prg.setPrognr(new Integer(lcsvp.getValueByLabel("ProgNr")));
					prg.setSuffix(lcsvp.getValueByLabel("Suffix"));
					prg.setTitel(lcsvp.getValueByLabel("Titel"));
					prg.setCapkleurknzb(lcsvp.getValueByLabel("CapKleur_KNZB"));
					prg.setCapkleur(lcsvp.getValueByLabel("CapKleur"));
					prg.setAfstand(new Integer(lcsvp.getValueByLabel("Afstand")));
					prg.setSlag(lcsvp.getValueByLabel("Slag"));
					prg.setSex(lcsvp.getValueByLabel("Sex"));
					if(lcsvp.getValueByLabel("Sex").equalsIgnoreCase("A"))
						prg.setSex("M");
					prg.setLeeftijdvan(lcsvp.getValueByLabel("LeeftijdVan"));
					prg.setLeeftijdtm(lcsvp.getValueByLabel("LeeftijdTM"));
					prg.create();
					nrOfStarts = new Integer(nrOfStarts.intValue() + 1);
				}
				
				boolean hasBegun1 = SConnection.getConnection().hasBegun();
				if( ! hasBegun1 ) { SConnection.begin(); }
				SConnection.rawUpdateDB("INSERT INTO statistiekenperprogramma (ProgNr, Suffix,Titel) "+
						"SELECT ProgNr,Suffix,Titel FROM programma");
				SConnection.commit();
				JOptionPane.showMessageDialog(null,
						nrOfStarts.toString()+" programma's binnengehaald en opgeslagen.",
						"Import", JOptionPane.INFORMATION_MESSAGE);
				lcsvp.close();
			} catch (FileNotFoundException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (IllegalStateException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (IOException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (SValidationException e) {
				JOptionPane.showMessageDialog(null,
						"Record "+nrOfStarts.toString()+e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			}
		}
		
	}
	
/*
 *  Zoek Programmanummers bestand
 */
	private class ZoekProgtitelsButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
		    JFileChooser chooser = new JFileChooser(importPath);
		    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
		    chooser.setSelectedFile(new File(getProgtitelBestandTextField().getText()));
		    chooser.addChoosableFileFilter(new ImportFileFilter("prognrs"));
		    int returnVal = chooser.showOpenDialog(getImportPanel());
		    if(returnVal == JFileChooser.APPROVE_OPTION) {
		    	File file = chooser.getSelectedFile();
		    	importPath = file.getParent();
		    	getProgtitelBestandTextField().setText(file.getPath());
		    }
		}
		
	}

/*
 *  Importeer Programmanummer bestand
 */
	private class LaadProgtitelsButtonActionListener implements ActionListener {
		public void actionPerformed(ActionEvent arg0) {
			//Open LabeledCVSParser
			Integer nrOfStarts = new Integer(0);
			boolean hasBegun = SConnection.getConnection().hasBegun();
			if( ! hasBegun ) { SConnection.begin(); }
			SConnection.rawUpdateDB("DELETE FROM programmanummers");
			SConnection.commit();

			try {
				LabeledCSVParser lcsvp = new LabeledCSVParser(new CSVParser(new FileInputStream(getProgtitelBestandTextField().getText())));
				lcsvp.changeDelimiter(';');

				while(lcsvp.getLine() != null) {

					ProgrammanummersBean strt = new ProgrammanummersBean();
					strt.setPrognr(new Integer(lcsvp.getValueByLabel("ProgNr")));
					strt.setTitel(lcsvp.getValueByLabel("Titel"));
					strt.create();

					nrOfStarts = new Integer(nrOfStarts.intValue() + 1);
				}
				
				JOptionPane.showMessageDialog(null,
						nrOfStarts.toString()+" programmanummers binnengehaald en opgeslagen.",
						"Import", JOptionPane.INFORMATION_MESSAGE);
				lcsvp.close();

			} catch (FileNotFoundException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (IllegalStateException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (IOException e) {
				JOptionPane.showMessageDialog(null,
						e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			} catch (SValidationException e) {
				JOptionPane.showMessageDialog(null,
						"Record "+nrOfStarts.toString()+e.getMessage(),
						"Import", JOptionPane.ERROR_MESSAGE);
			}

		}
		
	}
	
	/**
	 * This is the default constructor
	 */
	public ImportOLOWIS() {
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
		gridBagConstraints17.gridx = 0;
		gridBagConstraints17.fill = GridBagConstraints.BOTH;
		gridBagConstraints17.gridy = 2;
		this.setLayout(new BorderLayout());
		this.setSize(566, 134);
		this.add(getJPanel(), BorderLayout.NORTH);
	}

	/**
	 * This method initializes jTextField	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getStartsBestandTextField() {
		if (startsBestandTextField == null) {
			startsBestandTextField = new JTextField();
		}
		return startsBestandTextField;
	}

	/**
	 * This method initializes jButton	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLaadStartsButton() {
		if (laadStartsButton == null) {
			laadStartsButton = new JButton();
			laadStartsButton.setText("Laad");
			laadStartsButton.addActionListener(new LaadStartsButtonActionListener());
		}
		return laadStartsButton;
	}

	/**
	 * This method initializes jButton1	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getZoekStartsButton() {
		if (zoekStartsButton == null) {
			zoekStartsButton = new JButton();
			zoekStartsButton.setText("Zoek");
			zoekStartsButton.addActionListener(new ZoekStartsButtonActionListener());
		}
		return zoekStartsButton;
	}

	/**
	 * This method initializes jTextField1	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getProgrammaBestandTextField() {
		if (programmaBestandTextField == null) {
			programmaBestandTextField = new JTextField();
		}
		return programmaBestandTextField;
	}

	/**
	 * This method initializes jButton2	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLaadProgrammaButton() {
		if (laadProgrammaButton == null) {
			laadProgrammaButton = new JButton();
			laadProgrammaButton.setText("Laad");
			laadProgrammaButton.addActionListener(new LaadProgrammaButtonActionListener());
		}
		return laadProgrammaButton;
	}

	/**
	 * This method initializes jButton3	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getZoekProgrammaButton() {
		if (zoekProgrammaButton == null) {
			zoekProgrammaButton = new JButton();
			zoekProgrammaButton.setText("Zoek");
			zoekProgrammaButton.addActionListener(new ZoekProgrammaButtonActionListener());
		}
		return zoekProgrammaButton;
	}

	/**
	 * This method initializes jTextField2	
	 * 	
	 * @return javax.swing.JTextField	
	 */
	private JTextField getProgtitelBestandTextField() {
		if (progtitelBestandTextField == null) {
			progtitelBestandTextField = new JTextField();
		}
		return progtitelBestandTextField;
	}

	/**
	 * This method initializes jButton4	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getLaadProgtitelsButton() {
		if (laadProgtitelsButton == null) {
			laadProgtitelsButton = new JButton();
			laadProgtitelsButton.setText("Laad");
			laadProgtitelsButton.addActionListener(new LaadProgtitelsButtonActionListener());
		}
		return laadProgtitelsButton;
	}

	/**
	 * This method initializes jButton5	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getZoekProgtitelsButton() {
		if (zoekProgtitelsButton == null) {
			zoekProgtitelsButton = new JButton();
			zoekProgtitelsButton.setText("Zoek");
			zoekProgtitelsButton.addActionListener(new ZoekProgtitelsButtonActionListener());
		}
		return zoekProgtitelsButton;
	}

	/**
	 * This method initializes importPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getImportPanel() {
		if (importPanel == null) {
			jLabel = new JLabel();
			jLabel.setText("starts.csv");
			jLabel1 = new JLabel();
			jLabel1.setText("programma.csv");
			jLabel2 = new JLabel();
			jLabel2.setText("progtitels.csv");
			GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
			gridBagConstraints12.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints12.gridy = 2;
			gridBagConstraints12.gridx = 3;
			GridBagConstraints gridBagConstraints13 = new GridBagConstraints();
			gridBagConstraints13.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints13.gridy = 2;
			gridBagConstraints13.gridx = 2;
			GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
			gridBagConstraints11.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints11.gridx = 1;
			gridBagConstraints11.gridy = 2;
			gridBagConstraints11.ipadx = 200;
			gridBagConstraints11.weightx = 1.0;
			gridBagConstraints11.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
			gridBagConstraints10.insets = new Insets(0, 5, 0, 5);
			gridBagConstraints10.gridy = 2;
			gridBagConstraints10.anchor = GridBagConstraints.EAST;
			gridBagConstraints10.gridx = 0;
			GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
			gridBagConstraints6.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints6.gridy = 1;
			gridBagConstraints6.gridx = 3;
			GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
			gridBagConstraints7.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints7.gridy = 1;
			gridBagConstraints7.gridx = 2;
			GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
			gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints5.gridx = 1;
			gridBagConstraints5.gridy = 1;
			gridBagConstraints5.weightx = 1.0;
			gridBagConstraints5.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
			gridBagConstraints4.insets = new Insets(0, 5, 0, 5);
			gridBagConstraints4.gridy = 1;
			gridBagConstraints4.anchor = GridBagConstraints.EAST;
			gridBagConstraints4.gridx = 0;
			GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
			gridBagConstraints2.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints2.gridy = 3;
			gridBagConstraints2.gridx = 3;
			GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
			gridBagConstraints3.insets = new Insets(5, 5, 5, 5);
			gridBagConstraints3.gridy = 3;
			gridBagConstraints3.gridx = 2;
			GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
			gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
			gridBagConstraints1.gridy = 3;
			gridBagConstraints1.gridx = 1;
			gridBagConstraints1.ipadx = 200;
			gridBagConstraints1.insets = new Insets(5, 5, 5, 5);
			GridBagConstraints gridBagConstraints = new GridBagConstraints();
			gridBagConstraints.insets = new Insets(0, 5, 0, 5);
			gridBagConstraints.gridy = 3;
			gridBagConstraints.anchor = GridBagConstraints.EAST;
			gridBagConstraints.gridx = 0;
			importPanel = new JPanel();
			importPanel.setLayout(new GridBagLayout());
			importPanel.setBorder(BorderFactory.createTitledBorder(null, "Zoek de OLOWIS bestanden en laad ze", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
			importPanel.add(jLabel, gridBagConstraints);
			importPanel.add(getStartsBestandTextField(), gridBagConstraints1);
			importPanel.add(getZoekStartsButton(), gridBagConstraints3);
			importPanel.add(getLaadStartsButton(), gridBagConstraints2);
			importPanel.add(jLabel1, gridBagConstraints4);
			importPanel.add(getProgrammaBestandTextField(), gridBagConstraints5);
			importPanel.add(getZoekProgrammaButton(), gridBagConstraints7);
			importPanel.add(getLaadProgrammaButton(), gridBagConstraints6);
			importPanel.add(jLabel2, gridBagConstraints10);
			importPanel.add(getProgtitelBestandTextField(), gridBagConstraints11);
			importPanel.add(getZoekProgtitelsButton(), gridBagConstraints13);
			importPanel.add(getLaadProgtitelsButton(), gridBagConstraints12);
		}
		return importPanel;
	}

	/**
	 * This method initializes jPanel	
	 * 	
	 * @return javax.swing.JPanel	
	 */
	private JPanel getJPanel() {
		if (jPanel == null) {
			jPanel = new JPanel();
			jPanel.setLayout(new BorderLayout());
			jPanel.add(getImportPanel(), BorderLayout.NORTH);
		}
		return jPanel;
	}
}  //  @jve:decl-index=0:visual-constraint="10,10"
